org.eclipse.vtp.framework.interactions.voice.media
Class SimpleEnglishVoiceFormatter

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.voice.media.VoiceFormatter
      extended by org.eclipse.vtp.framework.interactions.voice.media.SimpleEnglishVoiceFormatter
All Implemented Interfaces:
IFormatter

public class SimpleEnglishVoiceFormatter
extends VoiceFormatter

This implementation of IFormatter provides basic support for the English language. Audio files are used when available; otherwise text content is used. This formatter does not perform advanced audio selection, such as using specific audio files for numbers in the middle of a grouping.

This class can be used as a guide to construct other formatter implementations, but is not meant to be directly subclassed.

Since:
3.0
Author:
Trip Gilman

Field Summary
 
Fields inherited from class org.eclipse.vtp.framework.interactions.voice.media.VoiceFormatter
NEGATIVE_ONE, ZERO
 
Constructor Summary
SimpleEnglishVoiceFormatter()
          Constructs a new SimpleEnglishVoiceFormatter.
 
Method Summary
 java.util.List formatDate(java.util.Date date, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied date information into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatDigits(java.lang.String digits, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied string of digits into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatLetters(java.lang.String text, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied string of letters into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatMoney(java.math.BigDecimal money, java.util.Currency currency, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied monetary amount into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatNumber(int number, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied number into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List formatOrdinal(int ordinal, java.lang.String formatDefinition, IResourceManager resourceManager)
          Transforms the supplied ordinal value into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used.
 java.util.List getDefaultFormats(FormattableContent formattable)
          Returns the List of Strings containing the readable names of any built-in specializations available for given formattable content.
 java.lang.String getLanguageCode()
           
 java.lang.String getLanguageName()
           
 
Methods inherited from class org.eclipse.vtp.framework.interactions.voice.media.VoiceFormatter
getAudioContent, getDefaultFormatDefintion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEnglishVoiceFormatter

public SimpleEnglishVoiceFormatter()
Constructs a new SimpleEnglishVoiceFormatter.

Method Detail

formatDate

public java.util.List formatDate(java.util.Date date,
                                 java.lang.String formatDefinition,
                                 IResourceManager resourceManager)
Description copied from interface: IFormatter
Transforms the supplied date information into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
date - The date to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided date.

formatDigits

public java.util.List formatDigits(java.lang.String digits,
                                   java.lang.String formatDefinition,
                                   IResourceManager resourceManager)
Description copied from interface: IFormatter
Transforms the supplied string of digits into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
digits - The digits to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided sequence of digits.

formatLetters

public java.util.List formatLetters(java.lang.String text,
                                    java.lang.String formatDefinition,
                                    IResourceManager resourceManager)
Description copied from interface: IFormatter
Transforms the supplied string of letters into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided string of letters.

formatMoney

public java.util.List formatMoney(java.math.BigDecimal money,
                                  java.util.Currency currency,
                                  java.lang.String formatDefinition,
                                  IResourceManager resourceManager)
Description copied from interface: IFormatter
Transforms the supplied monetary amount into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
money - The amount to translate to text.
currency - The currency the amount is in.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided monetary value.

formatNumber

public java.util.List formatNumber(int number,
                                   java.lang.String formatDefinition,
                                   IResourceManager resourceManager)
Description copied from interface: IFormatter
Transforms the supplied number into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
number - The number to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided number.

formatOrdinal

public java.util.List formatOrdinal(int ordinal,
                                    java.lang.String formatDefinition,
                                    IResourceManager resourceManager)
Description copied from interface: IFormatter
Transforms the supplied ordinal value into a language specific sequence of elements following the given definition using the provided resource manager to locate file resources.

If the definition is not recognized or invalid, the default definition should be used. This event may be logged but should never produce an exception.

Parameters:
ordinal - The ordinal to translate to text.
formatDefinition - The provided specialized format to use during transformation.
resourceManager - Provides access to the available file resources.
Returns:
A list of org.eclipse.vtp.framework.interactions.core.media.Content objects that contain the formatted elements of the provided ordinal value.

getLanguageCode

public java.lang.String getLanguageCode()
Returns:
The language code supported by this formatter, e.g. en-US.

getLanguageName

public java.lang.String getLanguageName()
Returns:
The readable name of the language supported by this formatter, e.g. English.

getDefaultFormats

public java.util.List getDefaultFormats(FormattableContent formattable)
Description copied from interface: IFormatter
Returns the List of Strings containing the readable names of any built-in specializations available for given formattable content. Not all formattable content will have built-in specializations.

A phone number would be a good example of a specialization that could be created for the DigitsContent type of content. There are some common rules around how a phone number is read back in contrast to just a string of numbers.

Specified by:
getDefaultFormats in interface IFormatter
Overrides:
getDefaultFormats in class VoiceFormatter
Parameters:
formattable - The type of content to find specializations for.
Returns:
A list of strings or an empty list if no specializations are available.